<template>
  <div>
    <city-header></city-header>
    <city-list :hotcity="hotCities" :allcity="cities"></city-list>
    <CityLabel :labels="cities" />
  </div>
</template>

<script>
import axios from 'axios'
import CityHeader from './components/Header'
import CityList from './components/CityList'
import CityLabel from './components/CityLabel'
export default {
  name: 'City',
  components: {
    CityHeader,
    CityList,
    CityLabel
  },
  data () {
    return {
      hotCities: [],
      cities: {}
    }
  },
  methods: {
    getCityData () {
      axios.get('./api/city.json')
        .then(this.getCityDataSucc)
    },
    getCityDataSucc (res) {
      // console.log(res)
      res = res.data
      if (res.ret && res.data) {
        const data = res.data
        this.hotCities = data.hotCities
        this.cities = data.cities
      }
    }
  },
  mounted () {
    this.getCityData()
  }
}
</script>

<style lang="stylus" scoped>
</style>
